package org.canaan.http;

import org.apache.http.client.config.RequestConfig;

import java.util.Map;

/**
 * http语法创建者
 * @author Canaan
 * @date 2017/8/13
 */
public interface HttpBuilder {
    /**
     设置请求头
     @param header

     @return
     */
    HttpBuilder setHeader(Map<String, String> header);

    /**
     设置cookies
     @param cookies

     @return
     */
    HttpBuilder setCookies(Map<String, Object> cookies);

    /**
     追加cookies
     @param key
     @param val

     @return
     */
    HttpBuilder appendCookie(String key, Object val);

    /**
     设置requestConfig
     @param requestConfig
     @return
     */
    HttpBuilder setRequestConfig(RequestConfig requestConfig);

    /**
     重复执行次数
     @param repeatTimes
     @return
     */
    HttpBuilder setRepeatTimes(Integer repeatTimes);

    /**
     追加请求头
     @param key
     @param val
     @return
     */
    HttpBuilder appendHeader(String key, String val);

    /**
     是否返回cookies，默认不返回
     @return
     */
    HttpBuilder hasCookies();

    /**
     是否为单例，默认不是单例

     @return
     */
    HttpBuilder isSingle(boolean isSingle);

    /**
     是否自动关闭，默认是自动关闭
     @return
     */
    HttpBuilder notAutoClose();

    /**
     创建Client
     @return
     */
    HttpClient builder();
}
